﻿using System.Collections.Generic;
using Dsl.Ped.Common.Converters;
using NUnit.Framework;

namespace DSLPedCommonTest.Converters
{
    [TestFixture]
    public class CollectionToSizeConverterTest
    {
        private CollectionToCountConverter converter;

        [SetUp]
        public void SetUpForEachTest()
        {
            converter = new CollectionToCountConverter();
        }

        [Test, Description("Convert null collection")]
        public void CollectionToCountConverterTest1()
        {
            var obj = converter.Convert(null, typeof(object), null, null);
            Assert.AreEqual(0, obj);
        }

        [Test, Description("Convert empty collection")]
        public void CollectionToCountConverterTest2()
        {
            var obj = converter.Convert(new List<string>(), typeof(List<string>), null, null);
            Assert.AreEqual(0, obj);
        }

        [Test, Description("Convert non empty collection")]
        public void CollectionToCountConverterTest3()
        {
            var obj = converter.Convert(new List<string>() { "hello" }, typeof(List<string>), null, null);
            Assert.AreEqual(1, obj);
        }
    }
}
